#include "StdAfx.h"
#include "WorldTennisMachine.h"

CWorldTennisMachine::CWorldTennisMachine()
{
}

CWorldTennisMachine::~CWorldTennisMachine()
{
}

int CWorldTennisMachine::Init()
{
int ret = CLockNChaseMachine::Init();

MainCPU->SetUser(this);
SoundCPU->SetUser(this);
MainCPU->SetRead(ReadMainCPU);
MainCPU->SetOp(OpMainCPU);
SoundCPU->SetRead(ReadSoundCPU);
SoundCPU->SetOp(ReadSoundCPU);
return(ret);
}

void CWorldTennisMachine::Frame()
{
do
	{
	Line(97,33,1);
	} while(Scanline != 0);
}

u8 CWorldTennisMachine::OpMainCPU(void *user,u32 addr)
{
CWorldTennisMachine *M = (CWorldTennisMachine*)user;

if(addr == 0xC15F)				//mame hack to get it to work
	{
	M->NewROM[0xFC30] =
	M->MainROM[0xFC30] = 0;
	}
return(CLockNChaseMachine::OpMainCPU(user,addr));
}

u8 CWorldTennisMachine::ReadMainCPU(void *user,u32 addr)
{
CWorldTennisMachine *M = (CWorldTennisMachine*)user;

if(addr == 0xC15F)				//mame hack to get it to work
	{
	M->NewROM[0xFC30] =
	M->MainROM[0xFC30] = 0;
	}
return(CLockNChaseMachine::ReadMainCPU(user,addr));
}

u8 CWorldTennisMachine::ReadSoundCPU(void *user,u32 addr)
{
CWorldTennisMachine *M = (CWorldTennisMachine*)user;

if(addr >= 0x200 && addr < 0x1000)
	return(M->SoundROM[addr]);
if(addr >= 0xF000)
	return(M->SoundROM[addr & 0xFFF]);
return(CLockNChaseMachine::ReadSoundCPU(user,addr));
}
